﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class UserViewMap:EntityTypeConfiguration<UserView>
    {
        public UserViewMap()
        {
            this.HasKey(t => t.ViewID);
            this.ToTable("UserView");
            this.Property(t => t.ViewID).HasColumnName("ViewID");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.IP).HasColumnName("IP").IsUnicode(false).HasMaxLength(20);
            this.Property(t => t.ViewDate).HasColumnName("ViewDate");
            this.HasRequired(t => t.User).WithMany(t => t.UserView).HasForeignKey(d => d.UserID);
           // this.Ignore(t => t.Id);
        }
    }
}
